<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>书籍展示</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous"/>

    <!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous"/>

    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
</head>
<body>

    <div class="container">
        <div class="row clearfix">
            <div class="col-md-12 column">
                <div class="page-header">
                    <h1>
                        <small>书籍列表————显示所有书籍</small>
                    </h1>
                </div>
                <div class="row">
                    <div class="col-md-4 column">
                        <%--toAddBook--%>
                        <a class="btn btn-primary" href="${pageContext.request.contextPath}/book/toAddBooks">新增书籍</a>
                            <a class="btn btn-primary" href="${pageContext.request.contextPath}/book/allBooks">显示全部书籍</a>
                    </div>
                    <div class="col-md-4 column"></div>
                    <div class="col-md-4 column">
                        <%--查询书籍--%>
                        <form action="${pageContext.request.contextPath}/book/queryBook" method="post" style="float: right">
                            <input type="text" name="queryBookName" class="form-control" placeholder="请输入要查询得书籍的名称">
                            <input type="submit" value="提交" class="btn btn-primary">
                        </form>
                    </div>
                </div>
            </div>

        </div>
   <div class="row clearfix">
       <div class="col-md-12 column">
           <table class="table table-hover table-striped">
               <thead>
               <tr>
                   <th>书籍编号</th>
                   <th>书籍名称</th>
                   <th>书籍数量</th>
                   <th>书籍详情</th>
                   <th>操作</th>
               </tr>
               </thead>

               <%--书籍从数据库中查询出来，从list中遍历出来:foreach--%>
               <tbody>
               <c:forEach var="book" items="${list}">
                   <tr>
                       <td>${book.bookID}</td>
                       <td>${book.bookName}</td>
                       <td>${book.bookCounts}</td>
                       <td>${book.detail}</td>
                       <td><a href="${pageContext.request.contextPath}/book/toUpdateBook?id=${book.bookID}">修改</a>
                       &nbsp; | &nbsp;
                       <a href="${pageContext.request.contextPath}/book/deleteBook?id=${book.bookID}">删除</a></td>
                   </tr>
               </c:forEach>
               </tbody>
           </table>
       </div>
   </div>
    </div>

</body>
</html>
